package hello.word.m2.maven.jpa;

import hello.word.m2.maven.jpa.builder.MySQLJpqlBuilder;
import hello.word.m2.maven.jpa.support.CustomizedAnnotationSqlLocator;
import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.core.spi.JdbiPlugin;
import org.jdbi.v3.sqlobject.SqlObjects;

public class JpalPlugin implements JdbiPlugin {

    @Override
    public void customizeJdbi(Jdbi jdbi) {
        SqlObjects sqlObjectsConfig = jdbi.getConfig(SqlObjects.class);
        sqlObjectsConfig.setSqlLocator(new CustomizedAnnotationSqlLocator());

        JpqlBuilder jpqls = new MySQLJpqlBuilder();
        jdbi.configure(Jpqls.class, j -> j.setJpqlBuilder(jpqls));
//        jdbi.ge
    }
}
